fix(mac-crafter): Work around broken consecutive shell integration builds
authorClaudio Cambra <claudio.cambra@nextcloud.com>
Thu, 3 Apr 2025 07:39:41 +0000 (15:39 +0800)
committerbackportbot[bot] <backportbot[bot]@users.noreply.github.com>
Fri, 4 Apr 2025 13:32:43 +0000 (13:32 +0000)
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
admin/osx/mac-crafter/Sources/main.swift

index f7d723b80e3ada4c856b80d245d020b9f0a9f5fa..f659c82c541422b23fbfb7189d2c84b042d5c7ca 100644 (file)
@@ -208,21 +208,33 @@ struct Build: ParsableCommand {
             )
         }
 
-        print("Crafting \(appName) Desktop Client...")
-
-        let allOptionsString = craftOptions.map({ "--options \"\($0)\"" }).joined(separator: " ")
-
         let clientBuildDir = "\(buildPath)/\(craftTarget)/build/\(craftBlueprintName)"
+        print("Crafting \(appName) Desktop Client...")
         if fullRebuild {
             do {
                 try fm.removeItem(atPath: clientBuildDir)
             } catch let error {
                 print("WARNING! Error removing build directory: \(error)")
             }
+        } else {
+            // HACK: When building the client we often run into issues with the shell integration
+            // component -- particularly the FileProviderExt part. So we wipe out the build
+            // artifacts so this part gets build first. Let's first check if we have an existing
+            // build in the folder we expect
+            let shellIntegrationDir = "\(clientBuildDir)/work/build/shell_integration/MacOSX"
+            if fm.fileExists(atPath: shellIntegrationDir) {
+                print("Removing existing shell integration build artifacts...")
+                do {
+                    try fm.removeItem(atPath: shellIntegrationDir)
+                } catch let error {
+                    print("WARNING! Error removing shell integration build directory: \(error)")
+                }
+            }
         }
 
         let buildMode = fullRebuild ? "-i" : disableAppBundle ? "compile" : "--compile --install"
         let offlineMode = offline ? "--offline" : ""
+        let allOptionsString = craftOptions.map({ "--options \"\($0)\"" }).joined(separator: " ")
         guard shell(
             "\(craftCommand) --buildtype \(buildType) \(buildMode) \(offlineMode) \(allOptionsString) \(craftBlueprintName)"
         ) == 0 else {